
/*    HTTP Host:  b.static.ak.fbcdn.net                                        */
/*    Generated:  July 5th 2009 7:54:50 PM PDT                                 */
/*      Machine:  10.16.140.102                                                */
/*       Source:  Backing Store                                                */
/*     Location:  js/ciu5vpdypo0s8ogw.pkg.js h:e5r8gxhu                        */
/*       Locale:  en_US                                                        */
/*         Path:  js/ciu5vpdypo0s8ogw.pkg.js                                   */
function EMUFrame(containerId, eiData, contextType, flags, data) {
	this.eiData_ = eiData;
	this.flags_ = flags;
	this.contextType_ = contextType;
	this.data_ = data;
	this.containerId_ = containerId;
	this.container_ = $(this.containerId_);
	return this;
}
copy_properties(EMUFrame.prototype, {EVENT_HANDLER_PATH:"/ae.php", EVENT_NAME_CLICK:"clk", EVENT_NAME_FAN:"fan", EVENT_NAME_RSVP:"rsvp", EVENT_NAME_ADD_FRIEND:"frnd", EVENT_NAME_GET_DIALOG:"dlg", onEvent:function (eventName, eventData, handler, errorHandler) {
	var params = {i:this.eiData_, f:this.flags_, c:this.contextType_, en:eventName};
	if (eventData) {
		params.ed = JSON.encode(eventData);
	}
	if (!errorHandler) {
		var errorHandler = bagofholding;
	}
	if (handler) {
		new AsyncRequest().setURI(this.EVENT_HANDLER_PATH).setData(params).setHandler(handler).setErrorHandler(errorHandler).setTransportErrorHandler(errorHandler).send();
	} else {
		new AsyncSignal(this.EVENT_HANDLER_PATH, params).send();
	}
}, showContextualHelp:function (elem, title, body) {
	return new ContextualDialog().setContext(elem).setTitle(title).setBody(body).setButtons(Dialog.OK).show();
}});
function EMUASFrame(containerId, eiData, contextType, flags, data) {
	this.parent.construct(this, containerId, eiData, contextType, flags, data);
	if (this.data_.showAdFeedback) {
		new AdspaceAdsFeedback(this.containerId_).set_usage_data(this.data_.usageData).set_log_data(this.eiData_);
	}
	this.link_ = DOM.find(this.container_, "a.UIEMUASFrame_link");
	if (this.data_.isPreview) {
		this.link_.listen("click", this.onLinkPreview.bind(this, this.link_));
		var socialLinks = DOM.scry(this.container_, "a.UIEMUASSocialContextLink");
		for (var i = 0; i < socialLinks.length; i++) {
			socialLinks[i].listen("click", this.onSocialLinkPreview.bind(this, socialLinks[i]));
		}
	}
	return this;
}
EMUASFrame.extend("EMUFrame");
copy_properties(EMUASFrame.prototype, {flashHighlightElement:function (elem) {
	if (!elem) {
		return;
	}
	$(elem).setStyle("backgroundColor", "#fffccc");
	animation(elem).duration(1500).checkpoint().to("backgroundColor", "#FFFFFF").duration(1000).go();
}, onLinkPreview:function (elem) {
	var linkPreviewHTML = "";
	if ("#" != elem.getAttribute("href")) {
		var linkAttributes = {href:elem.getAttribute("href"), target:"_blank"};
		var linkPreviewSpan = $N("span", $N("a", linkAttributes, _tx("Preview link.")));
		var linkPreviewHTML = linkPreviewSpan.innerHTML;
	}
	this.showContextualHelp(elem, _tx("Linkable Area"), _tx("Users who click this area will link to the destination specified by this ad. {preview}", {preview:linkPreviewHTML}));
	return false;
}, onSocialLinkPreview:abstractMethod});
function EMUASStandardFrame(containerId, eiData, contextType, flags, data) {
	this.parent.construct(this, containerId, eiData, contextType, flags, data);
}
EMUASStandardFrame.extend("EMUASFrame");
function EMUASFanFrame(containerId, eiData, contextType, flags, data) {
	this.parent.construct(this, containerId, eiData, contextType, flags, data);
	var becomeFanLink = DOM.scry(this.container_, "a.UIEMUASfanFrame_becomeFanLink");
	if (becomeFanLink[0]) {
		var actionHandler = (!this.data_.isPreview) ? this.onFan.bind(this) : this.onFanPreview.bind(this, becomeFanLink[0]);
		becomeFanLink[0].listen("click", actionHandler);
	}
	return this;
}
EMUASFanFrame.extend("EMUASFrame");
copy_properties(EMUASFanFrame.prototype, {onFan:function () {
	if (this.locked_) {
		return false;
	}
	this.locked_ = true;
	this.onEvent(this.EVENT_NAME_FAN, null, this.onFanFrameResponse.bind(this), this.onFanFrameResponse.bind(this));
	return false;
}, onFanFrameResponse:function (response) {
	var data = response.getPayload();
	if (data.success) {
		var fanDiv = DOM.find(this.container_, ".UIEMUASFanFrame_fan");
		DOM.setContent(fanDiv, this.data_.justFannedString);
		this.flashHighlightElement(fanDiv);
	}
	this.locked_ = false;
}, onFanPreview:function (becomeFanLink) {
	this.showContextualHelp(becomeFanLink, _tx("Inline Facebook Page Fanning"), _tx("Users can directly fan your Facebook Page by clicking this link."));
	return false;
}, onSocialLinkPreview:function (elem) {
	this.showContextualHelp(elem, _tx("Social Actions"), _tx("Here users can see friends who have become a fan of your Facebook Page."));
	return false;
}});
function EMUASEventFrame(containerId, eiData, contextType, flags, data) {
	this.parent.construct(this, containerId, eiData, contextType, flags, data);
	var rsvpLink = DOM.scry(this.container_, "a.UIEMUASEventFrame_rsvpLink");
	if (rsvpLink[0]) {
		var actionHandler = (!this.data_.isPreview) ? this.onRSVP.bind(this) : this.onRSVPPreview.bind(this, rsvpLink[0]);
		rsvpLink[0].listen("click", actionHandler);
	}
	return this;
}
EMUASEventFrame.extend("EMUASFrame");
copy_properties(EMUASEventFrame.prototype, {onRSVP:function () {
	if (!this.dialog_) {
		this.dialog_ = new Dialog().setTitle(this.data_.eventName).setBody(_tx("Loading...")).show();
		this.onEvent(this.EVENT_NAME_GET_DIALOG, null, this.initRSVPDialog.bind(this), this.initRSVPDialogFail.bind(this));
	}
	return false;
}, initRSVPDialog:function (response) {
	var data = response.getPayload();
	if (data.success) {
		this.dialog_.setBody(data.dialogBody).setButtons([{name:"rsvp", label:_tx("RSVP")}, Dialog.CANCEL]).setCancelHandler(this.onRSVPCancel.bind(this)).setHandler(this.onRSVPSubmit.bind(this)).show();
	}
	return false;
}, initRSVPDialogFail:function (response) {
	this.dialog_.hide();
	this.dialog_ = null;
}, onRSVPCancel:function () {
	this.dialog_ = null;
}, onRSVPSubmit:function () {
	if (this.locked_) {
		return false;
	}
	this.locked_ = true;
	var rsvpValue = this.dialog_.getFormData().UIEMUASEventFrame_dialogRSVPSelect;
	this.onEvent(this.EVENT_NAME_RSVP, {rsvpStatus:rsvpValue}, this.onRSVPFrameResponse.bind(this), this.onRSVPFrameResponse.bind(this));
	this.dialog_ = null;
}, onRSVPFrameResponse:function (response) {
	var data = response.getPayload();
	if (data.success) {
		var rsvpDiv = DOM.find(this.container_, ".UIEMUASEventFrame_rsvp");
		DOM.setContent(rsvpDiv, data.statusString);
		this.flashHighlightElement(rsvpDiv);
	}
	this.locked_ = false;
}, onRSVPPreview:function (rsvpLink) {
	this.showContextualHelp(rsvpLink, _tx("Inline Event RSVP'ing"), _tx("Users can directly RSVP to your event by clicking this link."));
	return false;
}, onSocialLinkPreview:function (elem) {
	this.showContextualHelp(elem, _tx("Social Actions"), _tx("Here users can see friends who have RSVP'd to your event. "));
	return false;
}});
function EMUASPymkFrame(containerId, eiData, contextType, flags, data) {
	this.parent.construct(this, containerId, eiData, contextType, flags, data);
	this.link_.listen("click", this.onPymkClick.bind(this));
	var addFriend = DOM.scry(this.container_, "a.UIEMUASPymkFrame_friendLink");
	if (addFriend[0]) {
		addFriend[0].listen("click", this.onAddFriend.bind(this));
	}
	var explain = DOM.scry(this.container_, "a.UIEMUASPymkFrame_explanation");
	if (explain[0]) {
		explain[0].listen("click", this.onExplanation.bind(this));
	}
	if (data.pymkIsHideable) {
		this.arbiterHideToken_ = Arbiter.subscribe("emu/hide", bind(this, "onPymkHide"));
		onunloadRegister(bind(this, "arbiterUnsubscribeHide"));
	}
	return this;
}
EMUASPymkFrame.extend("EMUASFrame");
copy_properties(EMUASPymkFrame.prototype, {HIDE_ASYNC_PATH:"/ajax/pymk_emu.php", onPymkClick:function () {
	pymk_log_profile_click(this.data_.pymkId, this.data_.pymkPage, this.data_.pymkScore, this.data_.pymkSource);
}, onPymkHide:function (event, data) {
	if (!ge(this.container_.id)) {
		this.arbiterUnsubscribeHide();
		return;
	}
	var params = {replace:this.data_.pymkId, page:this.data_.pymkPage, score:this.data_.pymkScore || -1, source:this.data_.pymkSource};
	new AsyncRequest().setURI(this.HIDE_ASYNC_PATH).setData(params).setHandler(this.onPymkHideResponse.bind(this)).send();
	animation(this.container_).from("opacity", 1).to("opacity", 0).duration(400).go();
}, onPymkHideResponse:function (data) {
	var insertedNodes = DOM.replace(this.container_, HTML(data.payload));
	this.arbiterUnsubscribeHide();
	if (!insertedNodes[0]) {
		return;
	}
	animation(insertedNodes[0]).from("opacity", 0).to("opacity", 1).duration(400).go();
}, arbiterUnsubscribeHide:function () {
	if (this.arbiterHideToken_) {
		Arbiter.unsubscribe(this.arbiterHideToken_);
	}
}, onAddFriend:function () {
	var friend_dialog = new ConnectDialog(this.data_.pymkId, "people_you_may_know", this.onAddFriendCompleted.bind(this), {"uid":this.data_.pymkId, "render_explanation":true, "page":this.data_pymkPage}, false, null, this.data_.pymkScore, this.data_.pymkSource, this.data_.pymkPage);
	friend_dialog.show();
	return false;
}, onExplanation:function (e) {
	(new Dialog()).setTitle(this.data_.pymkExplanationTitle).setBody(this.data_.pymkExplanationBody).setButtons(Dialog.OK).show();
	return false;
}, onAddFriendCompleted:function () {
	if (this.locked_) {
		return false;
	}
	this.locked_ = true;
	this.onEvent(this.EVENT_ADD_FRIEND);
	var friendDiv = DOM.find(this.container_, ".UIEMUASPymkFrame_friend");
	DOM.setContent(friendDiv, this.data_.pymkAddedString);
	this.flashHighlightElement(friendDiv);
	this.locked_ = false;
}});
function grab_new_content() {
	aiert("going to grab new content!");
}
function trusted_set_url_type_and_reload(obj, view) {
	var type = obj.options[obj.selectedIndex].value;
	var uri = new URI("/trusted/?view=" + view + "&type=" + type);
	uri.go();
}
function tua_set_inline_mode(value) {
	var onresponse = function (asyncResponse) {
		window.location.reload();
	};
	new AsyncRequest().setURI("/ajax/trusted/save_inline_mode.php").setData({"inline_mode":value}).setHandler(onresponse).send();
}
function tua_show_label_dialog(obj_id, obj_type) {
	var onResponse = function (asyncResponse) {
		var payload = asyncResponse.getPayload();
		new Dialog().setTitle("Report content").setBody(payload["html"]).setButtons(Dialog.OK_AND_CANCEL).setHandler(function () {
			tua_save_inline_label();
		}).show();
	};
	new AsyncRequest().setURI("/ajax/trusted/show_inline_label_dialog.php").setData({"obj_id":obj_id, "obj_type":obj_type}).setHandler(bind(this, onResponse)).send();
}
function tua_save_inline_label() {
	var obj_id = $("tua_label_form").obj_id.value;
	var obj_type = $("tua_label_form").obj_type.value;
	var inputs = $("tua_label_form").getElementsByTagName("INPUT");
	var label_bm = 0;
	for (var ii = 0; ii < inputs.length; ii++) {
		if (inputs[ii].checked) {
			label_bm = label_bm | inputs[ii].value;
		}
	}
	new AsyncRequest().setURI("/ajax/trusted/save_inline_label.php").setData({"obj_id":obj_id, "obj_type":obj_type, "label_bm":label_bm}).send();
}
if (window.Bootloader) {
	Bootloader.done(["js/ciu5vpdypo0s8ogw.pkg.js"]);
}

